package com.yeyks.hotel.dal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeyks.common.result.screen.DataGreenVipHotelMonthResult;
import com.yeyks.hotel.dal.domain.HotelInfo;
import com.yeyks.hotel.dto.HotelInfoC2bHotelSearchDto;
import com.yeyks.hotel.dto.HotelInfoC2bHotelVipSearchDto;
import com.yeyks.hotel.dto.HotelSearchResult;
import com.yeyks.hotel.dto.VipSearchResult;
import com.yeyks.hotel.param.HotelInfoC2bHotelSearchParam;
import com.yeyks.hotel.param.HotelInfoC2bHotelVipSearchParam;
import com.yeyks.hotel.param.HotelQueryParam;
import com.yeyks.hotel.param.HotelSearchJipAppendNewHotelListParam;
import com.yeyks.hotel.vo.HotelInfoHotelSearchVoHotle;
import com.yeyks.hotel.vo.HotelInfoHotelSearchVoRoomCalendar;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 酒店信息表 Mapper 接口
 * </p>
 *
 * @author yun
 * @since 2019-06-25
 */
public interface HotelInfoMapper extends BaseMapper<HotelInfo> {

    int insertReturnId(HotelInfo record);

    List<HotelInfo> selectByOperator(@Param("operator") Integer operator);

    HotelInfo selectByHotelManager(@Param("operator") Integer operator);

    List<HotelInfo> searchHotelsNoTaxExpired(@Param("id") Integer id);

    List<HotelInfo> selectByAdministrator(@Param("admin") Integer admin);

//    List<HotelInfo> selectByAdministrators(@Param("admins") List<Integer> admins);

    List<HotelInfo> selectByIds(@Param("ids") List<Integer> ids);


    List<Map> selectByFiltersEx(HotelQueryParam hotelQueryParam);

    int selectByFiltersExCount(HotelQueryParam hotelQueryParam);

    int updateStatusByIds(@Param("ids") List<Integer> ids,
                          @Param("status") Integer status,
                          @Param("extraInfo") String extraInfo);

    int updateValidByIds(@Param("ids") List<Integer> ids,
                         @Param("valid") Boolean status);

    int updateIfNotNullByPrimaryKey(HotelInfo record);

//    List<Map> countGroupByCityMgr(@Param("id") Integer id);

    //    List<Map> countGroupByBranch();
    int updateScore(@Param("id") Integer id);

//    int deleteAndUpdateById(@Param("id") Integer id, @Param("isDel") Integer isDel);

    HotelInfo selectByPrimaryKey(Integer id);

    HotelInfo selectHotelInfoByOperatorId(Integer operatorId);

//    List<HotelInfo> selectAll();

    //查询某省代签约酒电列表
    List<HotelInfo> queryListByProvinceId(@Param("accountId") Integer accountId, @Param("offset") Integer offset,
                                          @Param("count") Integer count);

    //查询某省代签约酒电列表
    List<HotelInfo> queryListByCityAgentId(@Param("accountId") Integer accountId, @Param("offset") Integer offset,
                                           @Param("count") Integer count);

    //查询某区县运营中心签约酒店ID
    List<HotelInfo> queryListByAdminId(@Param("accountId") Integer accountId, @Param("offset") Integer offset,
                                       @Param("count") Integer count);

    int updateByPrimaryKey(HotelInfo record);

//    int updateAgentIdById(@Param("id") Integer id, @Param("provinceAgentId") Long provinceAgentId, @Param("cityAgentId") Long cityAgentId);

    int updatePayAccountById(@Param("id") Integer id, @Param("payAccounts") String payAccounts);

    int getNewHotelCount(@Param("dtStart") Date dtStart,
                         @Param("dtEnd") Date dtEnd,
                         @Param("findId") Integer findId,
                         @Param("type") Integer type);

    //根据登录用户获取其下面的酒店
    List<HotelInfo> queryHotelByLoginAdmin(@Param("loginAdminId") Integer loginAdminId, @Param("type") Integer type);

    int upgradeVipHotel(@Param("hotelId") Integer hotelId, @Param("vipFlag") Integer vipFlag);

    List<Map> searchHotel(Map<String, Object> map);

    Integer searchHotelCount(Map<String, Object> map);

    List<Map> searchHotelNew(Map<String, Object> map);

    List<Map> searchHotelV2(Map<String, Object> map);

    List<Map> searchHotelNoPrice(Map<String, Object> map);

    List<Map> searchHotelNoPriceV2(Map<String, Object> map);

    List<VipSearchResult> vipHotelSearch(Map<String, Object> map);

    Integer vipHotelSearchCount(Map<String, Object> map);

//    List<HotelSearchResult> c2bHotelSearch(Map<String, Object> map);

//    Integer countC2bHotelSearch(Map<String, Object> map);

    /**
     * c2b搜索的酒店信息
     *
     * @param hotelInfoC2bHotelSearchParam
     * @param distance
     * @return
     */
    List<HotelInfoC2bHotelSearchDto> c2bHotelSearch190701(@Param("param") HotelInfoC2bHotelSearchParam hotelInfoC2bHotelSearchParam, @Param("distance") Integer distance);

    /**
     * vip搜索的酒店信息
     *
     * @param hotelInfoC2bHotelVipSearchParam
     * @return
     */
    List<HotelInfoC2bHotelVipSearchDto> vipHotelSearch190701(@Param("param") HotelInfoC2bHotelVipSearchParam hotelInfoC2bHotelVipSearchParam);

    /**
     * 分页查询酒店信息数据
     * @param map 查询条件
     * @return 返回结果
     */
    List<HotelInfo> queryPageByParam(Map<String, Object> map);

    /**
     * 分页查询子酒店的集合新
     * @param map 查询条件
     * @return 返回结果
     */
    List<HotelInfo> queryPageByAccountId(Map<String, Object> map);


    /**
     * 查询运营商关联酒店
     * @param map 查询条件
     * @return 返回结果
     */
    List<HotelInfo> queryPageByBusinessId(Map<String, Object> map);

    /**
     * v3.4
     * b2c酒店搜索查酒店
     */
    List<HotelInfoHotelSearchVoHotle> b2cHotelSearchHotels(
            @Param("positionX") Double positionX
            , @Param("positionY") Double positionY
            , @Param("hotelName") String hotelName
            , @Param("distance") Integer distance
            , @Param("sort") Integer sort
    );
    /**
     * v3.4
     * b2c酒店搜索查房态最低房间数和最低价
     */
    List<HotelInfoHotelSearchVoRoomCalendar> b2cHotelSearchRoomCalendars(
            @Param("startDate") Date startDate
            , @Param("endDate") Date endDate
            , @Param("roomIds") List<Integer> roomIds
    );

    //jip搜索的酒店信息  v3.5
    List<HotelInfoC2bHotelVipSearchDto> jipHotelSearch(@Param("param") HotelInfoC2bHotelVipSearchParam hotelInfoC2bHotelVipSearchParam);

    //jip搜索的酒店信息  v3.5
    List<HotelInfoC2bHotelVipSearchDto> newHotelList(@Param("param") HotelSearchJipAppendNewHotelListParam param);

    /**
     * 查询6个月VIP酒店数据
     * @return 返回结果
     */
    List<DataGreenVipHotelMonthResult> statVipHotelSixMonth();
}
